package com.eatme.web.app.article.controller;

import com.eatme.web.exception.AppException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 健康检查接口
 */
@RestController
public class HealthCheckController {

    private static final Logger LOG = LoggerFactory.getLogger(HealthCheckController.class);

    /**
     * 健康检查接口
     * @return
     */
    @GetMapping("health")
    public String health() {
        LOG.info("View health api");
        return "App Is OK!";
    }

    /**
     * 异常测试接口
     * @return
     * @throws AppException
     */
    @GetMapping("exception")
    public String exception() throws AppException {
        LOG.info("View exception api");
        throw  new AppException("App has Same Problem!");
    }
}
